package cagt.tools.standard;

import java.util.HashSet;
import java.util.Set;

/**
 * Filters for standard card collections.
 * 
 * @author Konrad
 */
// TODO this class can be improved a lot
public final class Filters {

	private Filters() {
	}

	/**
	 * Return the cards of given figure only.
	 * 
	 * @param cards
	 * @param figure
	 * @return
	 */
	public static Set<StandardCard> filter(Set<StandardCard> cards,
			Figure figure) {
		if (cards == null || figure == null) {
			throw new IllegalArgumentException();
		}
		Set<StandardCard> result = new HashSet<StandardCard>();
		for (StandardCard card : cards) {
			if (card.getFigure() == figure) {
				cards.add(card);
			}
		}
		return result;
	}
}
